package com.scsj.supermarket.presenter;

import com.scsj.supermarket.base.GetTakeCashDetailsBase;
import com.scsj.supermarket.bean.GetTakeCashDetailsBean;
import com.scsj.supermarket.model.GetTakeCashDetailsModel;

import dkmvp.mvp.BasePresenter;
import dkmvp.net.ResponseCallback;
import okhttp3.RequestBody;

/**
 * 提现详情信息presenter
 */

public class GetTakeCashDetailsPresenter extends BasePresenter implements GetTakeCashDetailsBase.IPresenter {

    private GetTakeCashDetailsBase.IModel mModel;
    private GetTakeCashDetailsBase.IView mView;

    public GetTakeCashDetailsPresenter(GetTakeCashDetailsBase.IView view) {
        mView = view;
        mModel = new GetTakeCashDetailsModel();
    }


    @Override
    public void deliverData(RequestBody requestBody) {
        addSubscription(mModel.getData(requestBody, new ResponseCallback<GetTakeCashDetailsBean>() {
            @Override
            public void onSuccess(GetTakeCashDetailsBean result) {
                if (result.getStatusCode() == 200) {
                    mView.showSuccessMsg("提现详情信息获取成功", result);
                } else {
                    mView.showErrorMsg(result.getMsg());
                }
            }

            @Override
            public void onFaild(String msg) {
                mView.showErrorMsg(msg);
            }
        }));
    }

}
